const user = {
	state: {
		userInfo: {}
	},
	mutations: {
		set_user_info(state, user) {
			console.log(user)
			state.userInfo = user
		}
	},
	actions: {
		GetUserInfo({commit}) {
			uni.request({
			    url: 'http://241121-0011.demo.boywe.cn/index/getUserInfo', //仅为示例，并非真实接口地址。
			    header: {
			        'Authorization': 'Bearer ' + uni.getStorageSync('Authorization')
			    },
			    success: (res) => {
			        var result = res.data
					if (result.code == 0) {
						console.log('请求成功了')
						commit('set_user_info', result.data)
					} else {
						if (result.code == 401) {
							uni.navigateTo({
								url: '/pages/login/login'
							})
						}
					}
			    }
			});
		}
	}
}
export default user